<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script>
    window.addEventListener('load',function (){
      const btn =document.querySelector('button')
      btn.addEventListener('click',function (){
        alert('11')
      })
    })
  </script>
</head>
<body>
<button>点击</button>
</body>
</html>